-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CS169 Iteration 1 Pull Request #291
Conversation
…s loaded on each run
reason to denial reason
…l template CRUD routes
Allow manually triggering specs
…flash-message Feature/187044317 add email resend flash message
Add request more info feature as an admin
187044314 add to field
…me-email-redirect edit redirect to use current path
…safety" This reverts commit 9fb64e9.
Fix email template reseed problem upon updates/deletion
…-reseed Refract implementation & test cases for email template seed
A new PR just merged into cs169's main branch, which fixes the implementation & tests for email reseed problem we discussed last Friday (Mar 1). |
Looks good so far but we can add more testing, especially for "Add request more info feature as admin". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments
@@ -146,7 +146,8 @@ def deny | |||
@teacher.denied! | |||
if !params[:skip_email].present? | |||
# TODO: Update dropdown to select the email template. | |||
TeacherMailer.deny_email(@teacher, params[:reason]).deliver_now | |||
puts params[:denial_reason] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clean this up. :)
@@ -1,7 +1,10 @@ | |||
<%# This part of the page is the email template form %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would delete a comment like this.
@@ -0,0 +1,5 @@ | |||
class ChangeToFieldForFormSubmission < ActiveRecord::Migration[6.1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should delete this file, or move it to a lib folder.
class AddToFieldToEmailTemplate < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :email_templates, :to, :string | ||
#below is the default prepopulated 'to' field value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Rails migrations should be used to change data, only the schema.
We should move this to the data migrating to a lib file or just to document what admins might need to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the class discussion, Michael thought we could just skip the migration for this part; he could just manually update the field.
At the new pull request, we may want to include this info for the migration note for the new PR, e.g. optionally to change the to
field of email template in that format
@@ -2,7 +2,12 @@ | |||
|
|||
require_relative "seed_data" | |||
|
|||
SeedData.emails.each { |email| EmailTemplate.find_or_create_by(email) } | |||
SeedData.emails.each do |email_attrs| | |||
# Based on what Professor Ball mentioned, 'title' is the unique identifier for each EmailTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments like this read a little funny. :)
{ title: email_attrs[:title] }
can just be passed directly to the find function
more_info: '' | ||
application_status: Denied | ||
school: berkeley | ||
education_level: -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should end with a new line.
case "deny": | ||
newAction = `/teachers/${teacherId}/deny`; | ||
newTitle = 'Deny ' + teacherName; | ||
inputName = 'denial_reason'; // The dynamic part for the input's name attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete the comment at the end of the line.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #291 +/- ##
==========================================
+ Coverage 81.95% 85.77% +3.82%
==========================================
Files 20 20
Lines 654 668 +14
==========================================
+ Hits 536 573 +37
+ Misses 118 95 -23 ☔ View full report in Codecov by Sentry. |
Pivotal Tracker Link
We decided to include the links to each of the pull requests that were made over the course of this iteration. See below. PRs are listed in chronological order, from earliest to most recent:
Change reason to denial reason: cs169#29
Add to field: cs169#30
Add email resend flash message: cs169#31
Add request more info feature as admin: cs169#32
Edit redirect to use current path: cs169#33
Fix email template reseed problem: cs169#34
What this PR does:
Implements iteration 1 features, including request more information button, the "to" field in the email template, and the flash message on resending emails. We also changed "reason" to "denial_reason" and fixed the duplicate email entry problem that occurs when you run "rails db:seed" after running migrations.
Include screenshots, videos, etc.
Who authored this PR?
How should this PR be tested?
See cucumber and RSpec tests, and view the latest deployment at https://sp24-01-bjc-teachers-d0e972207d82.herokuapp.com/dashboard.
https://sp24-01-bjc-teachers-d0e972207d82.herokuapp.com/dashboard
To make sure everything works as expected
No
Are there any complications to deploying this?
Basically no, but if there are any potential risks, the update feature of reseed might overwrite the old email templates in the database if the hashed values are the same.
Run "rails db:migrate" and "rails db:seed".
Checklist:
michael/12345-add-new-feature
Any branch name will do as long as the story ID is there. You can usegit checkout -b [new-branch-name]
)